/**
 *  @file SDLObjectFactory.h
 *
 *  @date 5-dec-2009
 *  @author Ives van der Flaas
 */

#ifndef SDLOBJECTFACTORY_H_
#define SDLOBJECTFACTORY_H_

#include <sstream>
#include <map>
#include "friendlyShip.h"
#include "objectFactory.h"
#include "representation.h"
#include "SDLTimer.h"


namespace si_sdl
{
/**
 * Object factory for just about any complicated SDL object that is needed. Can also be used
 * to get backgrounds etc.
 */
class SDLObjectFactory: public si::ObjectFactory
{
public:
	SDLObjectFactory() { load(); }

	std::tr1::shared_ptr<si::Timer> getTimer() { return std::tr1::shared_ptr<si::Timer>(new SDLTimer()); }
	virtual std::tr1::shared_ptr<si::EnemyShip> getEnemyFighter(si::Vector2 virtualStartPosition, si::ShipDescr descr);
	virtual std::tr1::shared_ptr<si::FriendlyShip> getFriendlyFighter();
	virtual std::tr1::shared_ptr<si::Representation> getBackground(int level);
	virtual std::tr1::shared_ptr<si::LevelTitle> getLevelTitle(std::string title);

private:
	/**
	 * Loads all data necessary from an xml file.
	 */
	void load();
	/**
	 * Maps a shipname to a filename where the representation
	 * for that ship can be found.
	 */
	std::map<std::string, std::string> fShipFilenames;
};

}

#endif /* SDLOBJECTFACTORY_H_ */
